<template>
  <dt-modal-edit ref="edit" title="奖金参数配置" :label-width="150" :width="500" @ok="onOk"></dt-modal-edit>
</template>

<script>
  import ConfigOpt from '../opt/ConfigOpt.js'
  import paramsMgr from '@/biz/bonus/params.js'

  export default {
    data() {
      return {
        info: {
          bonusInitiateExtension: false,
          bonusApproveExtension: false,
          isLockTime: true
        }
      }
    },
    mounted() {},
    methods: {
      show(info) {
        this.info = {
          bonusInitiateExtension: info.bonusInitiateExtension,
          bonusApproveExtension: info.bonusApproveExtension,
          isLockTime: info.isLockTime,
          paramId: info.paramId
        }
        this.$refs.edit.show(new ConfigOpt(this.info), this.info)
      },
      hide() {
        this.$refs.edit.hide()
      },
      onOk() {
        paramsMgr.validTime({ ...this.info }).then((res) => {
          this.$Message.success('设置成功')
          this.$emit('success')
          this.hide()
        })
      }
    }
  }
</script>

<style lang="scss" scoped></style>
